package com.ruoyi.system.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.system.domain.ByDb15;
import com.ruoyi.system.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 统计Controller
 *
 * @author ruoyi
 * @date 2024-03-12
 */
@RestController
@RequestMapping("/system/static")
public class ByStaticController  extends BaseController {

    @Autowired
    private IEsService esService;

    @Autowired
    private ISysUserService userService;

    @Autowired
    private IByOrdersService iByOrdersService;

    @Autowired
    private IByUserChargeService byUserChargeService;

    @Autowired
    private IByOrdersItemService byOrdersItemService;

    @Autowired
    private IStandardSynService iStandardSynService;

    @Autowired
    private ISynLogFileService iSynLogFileService;


    @Autowired
    private IDownloadLogService iDownloadLogService;

    @Autowired
    private IViewLogService iViewLogService;

    /**
     * 总题录
     */
    @GetMapping(value = "/totalTitle")
    public AjaxResult totalTitle()
    {
        return success(esService.totalTitle());
    }

    /**
     * 国标题录
     */
    @GetMapping(value = "/gbTitle")
    public AjaxResult gbTitle()
    {
        return success(esService.gbTitle());
    }

    /**
     * 地标题录
     */
    @GetMapping(value = "/dbTitle")
    public AjaxResult dbTitle()
    {
        return success(esService.dbTitle());
    }

    /**
     * 内蒙古地方标准题录
     */
    @GetMapping(value = "/nmTitle")
    public AjaxResult nmTitle()
    {
        return success(esService.nmTitle());
    }

    /**
     * 蒙字标
     */
    @GetMapping(value = "/mTitle")
    public AjaxResult mTitle()
    {
        return success(esService.mTitle());
    }

    /**
     * 总文本
     */
    @GetMapping(value = "/totalFile")
    public AjaxResult totalFile()
    {
        return success(esService.totalFile());
    }

    /**
     * 用户数量
     */
    @GetMapping(value = "/totalUser")
    public AjaxResult totalUser()
    {
        SysUser user = new SysUser();
        return success(userService.selectUserList(user).size());
    }

    /**
     * 行标数量
     */
    @GetMapping(value = "/hbTitle")
    public AjaxResult hbTitle()
    {
        return success(esService.hbTitle());
    }

    /**
     * 团标题录
     */
    @GetMapping(value = "/tbTitle")
    public AjaxResult tbTitle()
    {
        return success(esService.tbTitle());
    }


    /**
     * 国外题录
     */
    @GetMapping(value = "/gwTitle")
    public AjaxResult gwTitle()
    {
        return success(esService.gwTitle());
    }

    /**
     * 国标文本
     */
    @GetMapping(value = "/gbText")
    public AjaxResult gbText()
    {
        return success(esService.gbText());
    }

    /**
     * 国外文本
     */
    @GetMapping(value = "/gwText")
    public AjaxResult gwText()
    {
        return success(esService.gwText());
    }

    /**
     * 行标文本
     */
    @GetMapping(value = "/hbText")
    public AjaxResult hbText()
    {
        return success(esService.hbText());
    }

    /**
     * 地标文本
     */
    @GetMapping(value = "/dbText")
    public AjaxResult dbText()
    {
        return success(esService.dbText());
    }

    /**
     * 团标文本
     */
    @GetMapping(value = "/tbText")
    public AjaxResult tbText()
    {
        return success(esService.tbText());
    }

    /**
     * 题录新增
     */
    @GetMapping(value = "/titleAdd")
    public AjaxResult titleAdd(String beginTime,String endTime)
    {
        return success(iStandardSynService.getMonthAdd(beginTime,endTime));
    }

    /**
     * 题录更新
     */
    @GetMapping(value = "/titleUpdateNum")
    public AjaxResult titleUpdateNum(String beginTime,String endTime)
    {
        return success(iStandardSynService.getMonthUpdate(beginTime,endTime));
    }

    /**
     * 文本新增
     */
    @GetMapping(value = "/textAdd")
    public AjaxResult textAdd(String beginTime,String endTime)
    {
        return success(iSynLogFileService.getMonthNum(beginTime,endTime));
    }

    /**
     * 下载量
     */
    @GetMapping(value = "/downLoad")
    public AjaxResult downLoad(String beginTime,String endTime)
    {
        return success(iDownloadLogService.downTotalNum(beginTime,endTime));
    }

    /**
     * 访问量
     */
    @GetMapping(value = "/viewTotalNum")
    public AjaxResult viewTotalNum(String beginTime,String endTime)
    {
        return success(iViewLogService.viewTotalNum(beginTime,endTime));
    }


    /**
     * 销售额
     */
    @GetMapping(value = "/totalMoney")
    public AjaxResult totalMoney(String beginTime,String endTime)
    {
        return success(iByOrdersService.totalPaid(beginTime,endTime));
    }


    /**
     * 每月充值金额
     */
    @GetMapping(value = "/chargeDeposit")
    public AjaxResult chargeDeposit(String beginTime,String endTime)
    {
        return success(byUserChargeService.getMonth(beginTime,endTime));
    }

    /**
     * 每月销售数量
     */
    @GetMapping(value = "/cellNumber")
    public AjaxResult cellNumber(String beginTime,String endTime)
    {
        return success(byOrdersItemService.getMonth(beginTime,endTime));
    }

    /**
     * 每月题录更新数量
     */
    @GetMapping(value = "/titleUpdate")
    public AjaxResult titleUpdate(String beginTime,String endTime)
    {
        return success(iStandardSynService.getMonth(beginTime,endTime));
    }

    /**
     * 每月文本更新数量
     */
    @GetMapping(value = "/fileUpdate")
    public AjaxResult fileUpdate(String beginTime,String endTime)
    {
        return success(iSynLogFileService.getMonth(beginTime,endTime));
    }


    /**
     * 每月国标更新数量
     */
    @GetMapping(value = "/gbTitleUpdate")
    public AjaxResult gbTitleUpdate(String beginTime,String endTime)
    {
        return success(iStandardSynService.getGbMonth(beginTime,endTime));
    }

    /**
     * 每月行标更新数量
     */
    @GetMapping(value = "/hbTitleUpdate")
    public AjaxResult hbTitleUpdate(String beginTime,String endTime)
    {
        return success(iStandardSynService.getHbMonth(beginTime,endTime));
    }

    /**
     * 每月地标新增数量
     */
    @GetMapping(value = "/dbTitleUpdate")
    public AjaxResult dbTitleUpdate(String beginTime,String endTime)
    {
        return success(iStandardSynService.getDbMonth(beginTime,endTime));
    }

    /**
     * 每月团标新增数量
     */
    @GetMapping(value = "/tbTitleUpdate")
    public AjaxResult tbTitleUpdate(String beginTime,String endTime)
    {
        return success(iStandardSynService.getTbMonth(beginTime,endTime));
    }
//--------------------------------------------------------------
    /**
     * 每月国标更新数量
     */
    @GetMapping(value = "/gbTitleUpdateTotal")
    public AjaxResult gbTitleUpdateTotal(String beginTime,String endTime)
    {
        return success(iStandardSynService.getGbMonthTotal(beginTime,endTime));
    }

    /**
     * 每月行标更新数量
     */
    @GetMapping(value = "/hbTitleUpdateTotal")
    public AjaxResult hbTitleUpdateTotal(String beginTime,String endTime)
    {
        return success(iStandardSynService.getHbMonthTotal(beginTime,endTime));
    }

    /**
     * 每月地标新增数量
     */
    @GetMapping(value = "/dbTitleUpdateTotal")
    public AjaxResult dbTitleUpdateTotal(String beginTime,String endTime)
    {
        return success(iStandardSynService.getDbMonthTotal(beginTime,endTime));
    }

    /**
     * 每月团标新增数量
     */
    @GetMapping(value = "/tbTitleUpdateTotal")
    public AjaxResult tbTitleUpdateTotal(String beginTime,String endTime)
    {
        return success(iStandardSynService.getTbMonthTotal(beginTime,endTime));
    }

//    ---------------------------------------------------------------------------------------

    /**
     * 每月行标更新数量
     */
    @GetMapping(value = "/downTotal")
    public AjaxResult downTotal(String beginTime,String endTime)
    {
        return success(iDownloadLogService.downTotal(beginTime,endTime));
    }

    /**
     * 每月行标更新数量
     */
    @GetMapping(value = "/viewTotal")
    public AjaxResult viewTotal(String beginTime,String endTime)
    {
        return success(iViewLogService.viewTotal(beginTime,endTime));
    }

//-------------------------------------------------------------------------------------------
    /**
     * 每月国标新增数量
     */
    @GetMapping(value = "/gbTitleAdd")
    public AjaxResult gbTitleAdd(String beginTime,String endTime)
    {
        return success(iStandardSynService.getGbMonthAdd(beginTime,endTime));
    }

    /**
     * 每月行标新增数量
     */
    @GetMapping(value = "/hbTitleAdd")
    public AjaxResult hbTitleAdd(String beginTime,String endTime)
    {
        return success(iStandardSynService.getHbMonthAdd(beginTime,endTime));
    }

    /**
     * 每月地标新增数量
     */
    @GetMapping(value = "/dbTitleAdd")
    public AjaxResult dbTitleAdd(String beginTime,String endTime)
    {
        return success(iStandardSynService.getDbMonthAdd(beginTime,endTime));
    }

    /**
     * 每月团标新增数量
     */
    @GetMapping(value = "/tbTitleAdd")
    public AjaxResult tbTitleAdd(String beginTime,String endTime)
    {
        return success(iStandardSynService.getTbMonthAdd(beginTime,endTime));
    }

}
